package co2.bean;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import co2.engine.DAOInterface;
import co2.pojos.Kelompok;
import co2.pojos.MstUser;
import co2.pojos.SoalLks;


@ManagedBean
@ViewScoped
public class DetailLksBean extends AbstractBean implements Serializable {
	private static final long serialVersionUID = 1L;

	@Autowired
	@Qualifier("daoI")
	private DAOInterface dao;
	
	private Kelompok kelompok;
	private List<MstUser> listAnggota;
	
	private SoalLks soal;
	
	@PostConstruct
	public void postCon(){
		Map map = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
		kelompok =(Kelompok) map.get("kelompok");
		
		listAnggota = dao.getDaftarAnggotaKelompok(kelompok.getId());
		soal = dao.getSoalLksByKelompokId(kelompok.getId());
	}

	public DAOInterface getDao() {
		return dao;
	}

	public void setDao(DAOInterface dao) {
		this.dao = dao;
	}

	public Kelompok getKelompok() {
		return kelompok;
	}

	public void setKelompok(Kelompok kelompok) {
		this.kelompok = kelompok;
	}

	public List<MstUser> getListAnggota() {
		return listAnggota;
	}

	public void setListAnggota(List<MstUser> listAnggota) {
		this.listAnggota = listAnggota;
	}

	public SoalLks getSoal() {
		return soal;
	}

	public void setSoal(SoalLks soal) {
		this.soal = soal;
	}

}
